﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using WebShopData;

namespace Projekt_2_ASP.NET
{
    public partial class Login : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
        }

        protected void Login1_Authenticate(object sender, AuthenticateEventArgs e)
        {
            //Koll mot databasen.
            string userName = Login1.UserName;
            string password = Login1.Password;
            int userId;
            e.Authenticated = WebShopDal.AuthenticateLoginValues(userName, password, out userId);
            
            if (e.Authenticated)
            {
                Session["UserID"] = userId;
                Response.Redirect("Main.aspx");
            }
        }

    }
}